package com.example.xianzhi.dao.impl;

import com.example.xianzhi.dao.AdDao;
import com.example.xianzhi.entity.TbAd;
import com.example.xianzhi.util.ORMUtil;

import java.util.List;

public class AdDaoImpl implements AdDao {

    @Override
    public List<TbAd> selectshufflingpic() {
        String sql=" SELECT * FROM tb_ad";
        List<TbAd> tbAds = new ORMUtil().selectList(TbAd.class, sql);



        return tbAds;
    }

    @Override
    public int insertshuffling(String ad_pic) {
        String sql=" INSERT INTO tb_ad(ad_pic) VALUES (?)";
        int i = new ORMUtil().executeDML(sql, ad_pic);
        return i;
    }

    @Override
    public int deleteshuffling(int ad_id) {
        String sql=" DELETE FROM tb_ad WHERE ad_id=?";
        int i = new ORMUtil().executeDML(sql, ad_id);

        return i;
    }
}
